package com.example.demo.dao;

import com.example.demo.domain.*;
import com.example.demo.support.CustomRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.transaction.annotation.Transactional;

@RepositoryRestResource(path = "profession")
public interface ProfessionRepository extends CustomRepository<Profession,Long> {
   // Profession findByProfessionName(String ProfessionName);
    Profession findByProfessionName(String ProfessionName);

    @Modifying
    @Transactional
    @Query("delete  from Profession p where p.ProfessionId = :id")
    boolean deleteByProfessionId(@Param("id") long id);


}
